#!/usr/bin/env bash
set -eufo pipefail

echo "Publishing as $(npm whoami)."

if ! npm outdated --long; then
  read -rp "Continue? [y/N] " choice
  if [[ "${choice-n}" != 'y' ]]; then
    echo 'Package distribution aborted.'
    exit 2
  fi
fi

npm run build
npm run build:dist
sed --in-place "s/Fluture@$PREVIOUS_VERSION/Fluture@$VERSION/" README.md
git add dist README.md
